home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGMISC / FPCDOCS.LZH / VIDEO2.SEQ < prev   
Text File  |  1988-08-05  |  5KB  |  116 lines

  1. \ VIDEO2.SEQ    Actual video output routine             By Tom Zimmer
  2.  
  3. FILES DEFINITIONS
  4.  
  5. VARIABLE VIDEO2.SEQ
  6.  
  7. FORTH DEFINITIONS
  8.  
  9. VARIABLE NOSETCUR
  10.  
  11. DECIMAL
  12.  
  13. CODE VIDEO-TYPE ( string length -- )
  14.                 MOV AX, #LINE
  15.                 MOV DX, #OUT
  16.                 POP BX
  17.                 cmp bx, # 0             \ if length = 0 then exit
  18.              <= if
  19.                         pop bx
  20.                         next
  21.                 then
  22.                 PUSH BX                 \ Put length and #OUT on stack
  23.                 PUSH DX
  24.                 cmp ax, # 24            \ Clip #LINE to 25 lines
  25.             u>= if
  26.                         mov ax, # 24
  27.                 then
  28.                 mov #line ax
  29.                 PUSH AX
  30.                 ADD DX, BX              \ Set length + X position to DL
  31.                 cmp dx, # 80            \ Clip #OUT to 80 characters
  32.             u>= if
  33.                         mov dx, # 80
  34.                 then
  35.                 mov #out dx
  36.                 cmp nosetcur # 0        \ Do we want to spend time setting
  37.              0= if                      \ the cursor position?
  38.                         MOV DH, AL      \ Move Y to DH
  39.                         XOR BX, BX      \ Clear BX
  40.                         MOV AH, # 2
  41.                         INT 16          \ Move cursor to end of typed string
  42.                 then
  43.                 MOV AX, # 160           \ calculate actual cursor position
  44.                 POP BX          MUL BX          MOV DI, AX
  45.                 POP AX          SHL AX, # 1     ADD DI, AX
  46.                 POP CX          POP BX
  47.                 XCHG SI, BX                     \ SI is the source
  48.                 PUSH BX                         \ Save SI for later restoral
  49.                 PUSH ES                         \ save ES
  50.                 MOV BX, # 1                     \ Bit mask for retrace
  51.                 MOV AX, VMODE-VAR
  52.                 CMP AX, # 7                     \ If video mode <> 7 (mono)
  53.         0<> IF          MOV AX, BLANKING
  54.                         OR AX, AX
  55.             0<> IF      MOV DX, # 986           \ CGA status port
  56.                         BEGIN   IN AL, DX       \ Wait for retrace
  57.                                 TEST AL, BX
  58.                     0<> UNTIL
  59.                         MOV DL, # 216           \ Address control reg
  60.                         MOV AL, # 37            \ Disable the CRT
  61.                         OUT DX, AL
  62.                 THEN
  63.             THEN
  64.                 MOV AH, ATTRIB                  \ display attributes
  65.                 MOV ES, VIDEO-SEG               \ destination segment
  66.                 cmp cx, # 80
  67.              >= if                              \ Clip line to 80 characters
  68.                         mov cx, # 80
  69.                 then
  70.                 mov dx, # 80
  71.                 sub dx, cx
  72.                 xchg dx, cx
  73.                 shl cx, # 1
  74.                 add cx, # here 10 +             \ Add base addr of array
  75.                 MOV DS, TYPESEG                 \ source segment
  76.                 jmp cx                          \ JUMP to the right instruction
  77.  
  78. \ we are blowing out the loop here for speed, it only cost 160 bytes.
  79.  
  80.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  81.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  82.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  83.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  84.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  85.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  86.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  87.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  88.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  89.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  90.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  91.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  92.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  93.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  94.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  95.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  96.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  97.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  98.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  99.         LODSB   STOSW   LODSB   STOSW   LODSB   STOSW   LODSB   STOSW
  100.                 POP ES                          \ restore ES
  101.                 POP SI                          \ Restore IP
  102.                 MOV BX, CS      MOV DS, BX      \ restore DS
  103.                 MOV AX, VMODE-VAR
  104.                 CMP AX, # 7
  105.         0<> IF          MOV AX, BLANKING
  106.                         OR AX, AX
  107.             0<> IF      MOV DX, # 984           \ CGA mode control reg
  108.                         MOV AL, # $2D           \ Enable byte for mode 3
  109.                         OUT DX, AL
  110.                 THEN
  111.             THEN
  112.                 NEXT            END-CODE
  113.  
  114. DECIMAL
  115.  
  116.